package bancosys.tec.persist.entities.domain;

import java.math.BigDecimal;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;

import jmine.tec.persist.annotation.Alias;

import org.hibernate.annotations.Filter;
import org.hibernate.annotations.Filters;

import bancosys.tec.persist.authorization.AuthorizableActionAware;
import bancosys.tec.persist.authorization.AuthorizationMode;
import bancosys.tec.persist.bussobj.AuthPersistableBusinessObject;
import bancosys.tec.persist.persister.annotation.NaturalKey;

@Entity
@Alias("MOV")
@Filters({ @Filter(name = "authFilter", condition = "auth = :auth") })
public class Mov extends AuthPersistableBusinessObject implements AuthorizableActionAware {

    private Long id;

    private String chave;

    private BigDecimal valor;

    private String authAction;

    private String teste;

    private AuthorizationMode authorizationMode;

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    public Long getId() {
        return this.id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    @Column
    public BigDecimal getValor() {
        return this.valor;
    }

    public void setValor(BigDecimal valor) {
        this.valor = valor;
    }

    @Column
    public String getAuthorizationAction() {
        return this.authAction;
    }

    public void setAuthorizationAction(Object authAction) {
        this.authAction = (String) authAction;
    }

    @Column
    public String getTeste() {
        return this.teste;
    }

    public void setTeste(String teste) {
        this.teste = teste;
    }

    @Column
    @NaturalKey
    public String getChave() {
        return this.chave;
    }

    public void setChave(String chave) {
        this.chave = chave;
    }

    /**
     * @return the authorizationMode
     */
    @Column(name = "AUTH_MODE")
    public AuthorizationMode getAuthorizationMode() {
        return this.authorizationMode;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public AuthorizationMode getAuthorizationMode(Object action) {
        return this.authorizationMode;
    }

    /**
     * @param authorizationMode the authorizationMode to set
     */
    public void setAuthorizationMode(AuthorizationMode authorizationMode) {
        this.authorizationMode = authorizationMode;
    }
}
